﻿using System;
using System.Collections.Generic;
using System.Text;

namespace NatNetClient
{
    public static class Binary
    {
        public static byte[] Write2BValue(long val, int idx, byte[] p)
        {
            p[idx] = (byte)((val >> 8) & 0xff); //Prima + significativi, poi meno significativi
            if (((val >> 8) & 0xff) == 0xff)
            {
                p[idx + 1] = (byte)((val >> 0) & 0xef);
            }
            else
            {
                p[idx + 1] = (byte)((val >> 0));
            }
            return p;
        }
    }
}
